import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
data = pd.read_csv("./QRS提取/datas/t2_data.csv")
data = data[:20000]
x_list = data["x"].values
y_list = data["y"].values 

figure, axes1 = plt.subplots()
axes2 = axes1.twinx()
plt.ion()
xs = [0, 1]
ys1 = [1, x_list[0]]
ys2 = [1, y_list[0]]
for i in range(1,len(x_list),5):
    y1 = x_list[i]
    y2 = y_list[i]
    xs[0] = xs[1]
    ys1[0] = ys1[1]
    ys2[0] = ys2[1]
    xs[1] = i
    ys1[1] = y1
    ys2[1] = y2
    axes1.plot(xs, ys1)
    axes2.plot(xs,ys2,"r--")
    plt.pause(0.1)